/*
 * Copyright (C) 2017-2019 Huawei Technologies Duesseldorf GmbH
 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019.
 *
 * Author: Roberto Sassu <roberto.sassu@huawei.com> and
 * adapt to RTOS 4.4 by Qixiao Liu <liuqixiao@huawei.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 *
 * File: ima_digest_list.h
 *      Header of ima_digest_list.c
*/

#ifndef __LINUX_IMA_DIGEST_LIST_H
#define __LINUX_IMA_DIGEST_LIST_H
#include "ima.h"

struct compact_list_hdr {
	u8 version;
	u8 _reserved;
	u16 type;
	u16 modifiers;
	u16 algo;
	u32 count;
	u32 datalen;
} __packed;

extern struct ima_h_table ima_digests_htable;
extern u64 ima_digest_list_count_max __ro_after_init;

extern struct ima_digest *ima_lookup_digest(u8 *digest, enum hash_algo algo);
extern int ima_parse_compact_list(loff_t size, char *buf);
extern void ima_set_digest_list_data_stat(bool set);
extern bool ima_get_digest_list_data_stat(void);
extern bool ima_digest_list_upload_stat(void);
extern void ima_set_digest_list_data_opened(bool set);
extern bool ima_get_digest_list_data_opened(void);
#endif /* LINUX_IMA_DIGEST_LIST_H */
